package com.guli.vod.utils;

import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author ZHAOZHENYU
 * @since 2022/9/29
 */

@Data
@Component
@ConfigurationProperties(prefix = "aliyun.vod.file")        // 得到配置文件里面的自定义value
public class ConstantPropertiesUtil implements InitializingBean {

    private String keyid;

    private String keysecret;

    @Value("${local.bucket}")
    private String localBucket;

    @Value("${nginx.proxy.url}")
    private String nginxProxyUrl;

    public static String ACCESS_KEY_ID;
    public static String ACCESS_KEY_SECRET;
    // 本地代理
    public static String LOCAL_BUCKET_PATH;
    public static String NGINX_PROXY_URL;


    // 加载配置文件后得到
    @Override
    public void afterPropertiesSet() throws Exception {
        ACCESS_KEY_ID = keyid;
        ACCESS_KEY_SECRET = keysecret;
        LOCAL_BUCKET_PATH = localBucket;
        NGINX_PROXY_URL = nginxProxyUrl;
    }
}
